\documentclass{article}

\usepackage{ctex}
\usepackage{graphicx}
\usepackage{float}
\usepackage{datetime}
\usepackage{listings}

\title{List Report}
\author{叶睿浩		3190104031}
\date{\today}

\begin{document}
	\maketitle
	这是List作业的Report

	\section{创建并输出List}
	利用头文件<DoubleLinkedList.h>创建双链表L。
	\begin{lstlisting}[language=C++]
	DoubleLinkedList<int> L;
	for(int i = 1;i <= 5; i++)
	L.push_back(i);
	L.printList();
	\end{lstlisting}
	
	控制台输出如下：
	\begin{lstlisting}[language=C++]
	>	0	1	2	3	4	5	0
	\end{lstlisting}
	
	\section{创建itr并移除}
	
	
	
	\begin{lstlisting}[language=C++]
		DoubleLinkedList<int>::iterator itr;
		
		int x = 3;
		itr = find(L,x);
		
		L.erase(itr);
		L.printList();
	\end{lstlisting}

	控制台输出如下：
	\begin{lstlisting}[language=C++]
	>	0	1	2	4	5	0
	\end{lstlisting}


	\section{用find函数再次寻找itr}
	\begin{lstlisting}[language=C++]
		itr = find(L,x);
	\end{lstlisting}

	控制台输出如下：
	\begin{lstlisting}[language=C++]
	>	3 is Not Found
	\end{lstlisting}

	\section{检查内存泄露}
	在控制台利用valgrind检查内存泄露情况:
	\begin{lstlisting}
	yrh@yrh-virtual-machine:~/data_structure/List$ valgrind ./main
	==5508== Memcheck, a memory error detector
	==5508== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
	==5508== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
	==5508== Command: ./main
	==5508== 
	0	1	2	3	4	5	0	
	0	1	2	4	5	0	
	3 is Not Found
	==5508== 
	==5508== HEAP SUMMARY:
	==5508==     in use at exit: 0 bytes in 0 blocks
	==5508==   total heap usage: 9 allocs, 9 frees, 73,896 bytes allocated
	==5508== 
	==5508== All heap blocks were freed -- no leaks are possible
	==5508== 
	==5508== For lists of detected and suppressed errors, rerun with: -s
	==5508== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
	\end{lstlisting}
\end{document}